'''
Created on Aug 24, 2010

@author: alia
'''
import cocos

from cocos.particle import *
from cocos.particle_systems  import *
class MSmoke( ParticleSystem ):

    # total particles
    total_particles = 150

    # duration
    duration = -1

    # gravity
    gravity = Point2(0,-100)

    # angle
    angle = 90.0
    angle_var = 10.0

    # speed of particles
    speed = 55.0
    speed_var = 5.0

    # radial
    radial_accel = 0
    radial_accel_var = 0

    # tangential
    tangential_accel = 0.0
    tangential_accel_var = 0.0

    # emitter variable position
    pos_var = Point2(0,0)

    # life of particles
    life = 2.0
    life_var = 1.0

    # size, in pixels
    size = 60.0
    size_var = 10.0

    # emits per frame
    emission_rate = total_particles / life

    # color of particles
    start_color = Color(0.2, 0.7, 0.7, 1.0)
    start_color_var = Color(0.0, 0.0, 0.0, 0.2)
    end_color = Color(0.0, 0.0, 0.0, 1.0)
    end_color_var = Color(0.0, 0.0, 0.0, 0.0)

    # blend additive
    blend_additive = True

    # color modulate
    color_modulate = True
    
    #texture = pyglet.resource.image('fire.png').texture


_extras = {
           "Smoke": Smoke
           }

#TODO: I think to fix this we need to add it to the layer!
def CreateExtra(extra_def):
    if extra_def is not None:
    
        global _extras
        
        type, pos, rotation, scale, zorder = extra_def
        extra = _extras.get(type, None)
        if extra is not None:
            obj = extra()
            obj.position = pos
            obj.rotation = rotation
            obj.scale = scale
            return obj, zorder
    
    return None, 0
    
    
    